package com.jdjinsui.xsign.atest

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.jdjinsui.xsign.atest.databinding.ActivityMainBinding
import com.jdjinsui.xsign.sdk.SignFragment

class MainActivity : AppCompatActivity() {

    private lateinit var binding: ActivityMainBinding

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        binding = ActivityMainBinding.inflate(layoutInflater)
        setContentView(binding.root)

        supportFragmentManager.setFragmentResultListener("onSave", this) { _, result ->
            val base64 = result.getString("base64")
            println(base64?.substring(0, 10))
        }
    }

    override fun onStart() {
        super.onStart()

        val fl = binding.fl.getFragment<SignFragment>()
        fl.setup("public/test.pdf")
    }
}